﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

namespace TSNPro.Utils
{
    public static class JObjectExtensions
    {
        // 扩展方法：获取 JObject 中的所有键
        public static List<string> GetAllKeys(this JObject obj)
        {
            List<string> keys = new List<string>();

            foreach (var property in obj.Properties())
            {
                keys.Add(property.Name);
            }

            return keys;
        }

        public static List<string> GetStringList(this JToken token)
        {
            return token.Value<JArray>().Select(x => x.ToString()).ToList();
        }
    }
}
